<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../dist/fxtpl.js"></script>

<title>Fxtpl</title>
<style>
body{ line-height: 1.5em;}
</style>
</head>

<body>
>> 返回匿名渲染函数
<div id="myTemplate_m1">
    
</div>

>> 返回渲染后的字符串
<div id="myTemplate_m2">
    
</div>
<script>
var title = '#音乐十年# 我在现场投票给了{{$starName}}，TA当前排名第{{$rank}}位共{{$votes}}票。';
var fn = null;
var data = {
    starName: '邓紫棋',
    rank: 1,
    votes: 128790
};
fn = Fxtpl.compile(title, '', {leftTag: '{{', rightTag: '}}'});
title = Fxtpl.compile(title, data, {leftTag: '{{', rightTag: '}}'});

document.getElementById('myTemplate_m1').innerHTML = fn;
document.getElementById('myTemplate_m2').innerHTML = title;
</script>
</body>
</html>
